package Data::Conveyor::Environment_TEST;

# $Id: Environment_TEST.pm 13049 2007-04-10 07:09:44Z gr $

use strict;
use warnings;
use Error::Hierarchy::Test 'throws2_ok';


our $VERSION = '0.02';


use base 'Data::Conveyor::Test';


use constant PLAN => 1;


sub run {
    my $self = shift;
    $self->SUPER::run(@_);

    my $env = $self->make_real_object;
    throws2_ok { $env->make_stage_object('foobar'); }
        'Error::Hierarchy::Internal::ValueUndefined',
        qr/no stage class name found for \[foobar\]/,
        'make a stage object for a nonexistent stage';

    # We release the cache for stage class names here. The bug which prompted
    # this is a bit involved. We ran all inline pod tests - via
    # 00podtests.t -, and this test ran first, so $env was of ref
    # Data::Conveyor::Environment. The above code calls
    # make_stage_object(), which indirectly caches the stage class name
    # results, so only ST_TXSEL is cached - since that's the only thing
    # defined in the environment's STAGE_CLASS_NAME_HASH().
    #
    # The next test (from another pod test file) used the config file
    # mechanism, which pointed to a config file from a different package,
    # and that config file uses a different environment. However, the
    # settings from that environment weren't seen because of the cached.

    $env->release_stage_class_name_hash;

}


1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

{% p.package %} - stage-based conveyor-belt-like ticket handling system

=head1 SYNOPSIS

    {% p.package %}->new;

=head1 DESCRIPTION

None yet. This is an early release; fully functional, but undocumented. The
next release will have more documentation.

=head1 METHODS

=over 4

{% p.write_methods %}

=back

{% p.write_inheritance %}

{% PROCESS standard_pod %}

=cut

